package day04.Polymorphic.IncomeCalcultor;

public class Main {
    public static void main(String[] args) {
        Income[] incomes = {new Income(3000),
                new SalaryIncome(7500), new RoyaltyIncome(12000)};

        System.out.println(totalTax(incomes));
    }

    public static double totalTax(Income... incomes) {
        double total = 0;
        for (Income income : incomes) {
            total = total + income.getTax();
        }
        return total;
    }
}
